﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Tasks;
using System.Device.Location;
using Microsoft.Phone.Controls.Maps;
using System.Windows.Media.Imaging;



namespace testDirection
{
    public partial class MainPage : PhoneApplicationPage
    {
        // Constructor
        public MainPage()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Phone.Controls.Maps.LocationRect tmpRect = new Microsoft.Phone.Controls.Maps.LocationRect(new GeoCoordinate(25.12,121.12),100,100);
            map1.Mode = new RoadMode();
           // map1.SetValue(PlaneProjection.CenterOfRotationZProperty, 180);
            

            Pushpin tmpPin = new Pushpin();
            var PushpinLayer = new MapLayer();
            map1.Children.Add(PushpinLayer);
            tmpPin.Visibility = System.Windows.Visibility.Visible;
            tmpPin.Background = new SolidColorBrush(Colors.Blue);
            //ImageBrush brush = new ImageBrush();
            //brush.ImageSource = new BitmapImage(new Uri("images/people.png", UriKind.Relative));
            //tmpPin.Background = brush;
            tmpPin.Location = new GeoCoordinate(23.6, 121.5);
            
            //map1.Children.Add(tmpPin);
            map1.SetView(new GeoCoordinate(23.6, 121.5), 13);
            PushpinLayer.AddChild(tmpPin, new GeoCoordinate(23.6, 121.5));
            RotateTransform rt = new RotateTransform();
            rt.Angle = 15;
            
            map1.RenderTransform = rt;
            map1.UpdateLayout();

        }
    }
}